package com.ctshk.app.iotc.controller;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.rpc.iotc.dto.OperateBankPreferenceListDTO;
import com.ctshk.rpc.iotc.req.Ids;
import com.ctshk.rpc.iotc.req.OperateBankConformReq;
import com.ctshk.rpc.iotc.service.IOperateBankPreferenceProductService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.ctshk.common.web.support.BaseController;

import javax.validation.Valid;
import java.util.List;

/**
 * <p>
 * 银联优惠适用产品 前端控制器
 * </p>
 *
 * @author 谢诗宏
 * @since 2021-01-22
 */
@Api(value = "银联优惠适用产品-app",tags = "银联优惠适用产品-app")
@RestController
@RequestMapping("/operate/bank/preference/product-app")
public class OperateBankPreferenceProductController extends BaseController {

    @DubboReference
    private IOperateBankPreferenceProductService iOperateBankPreferenceProductService;

    @ApiOperation(value = "查询银联优惠列表-app",notes = "查询银联优惠列表-app")
    @OperationLogAnnotation(operModul = OperationLogModel.IOTC,operType = OperationLogType.QUERY)
    @PostMapping("/list")
    public Result<List<OperateBankPreferenceListDTO>> list(@RequestBody @Valid OperateBankConformReq req){
        return Result.success(iOperateBankPreferenceProductService.list(req));
    }

    @ApiOperation(value = "查詢產品有沒有銀聯優惠-app",notes = "查詢產品有沒有銀聯優惠-app")
    @OperationLogAnnotation(operModul = OperationLogModel.IOTC,operType = OperationLogType.QUERY)
    @PostMapping("/getByProductId")
    public Result<List<OperateBankPreferenceListDTO>> list(@RequestBody @Valid Ids req){
        return iOperateBankPreferenceProductService.getOperateBankPreferenceProduct(req.getId());
    }
}
